package com.changhong.framework.sdfs.namenode.server;

import com.changhong.framework.sdfs.namenode.server.transport.NameNodeRpcServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * NameNode核心启动类，当namenode启动的时候需要先进行checkpoint的数据回放，然后在进行文件操作数据的回放
 * @author summer
 *
 */
public class NameNode {

	private static final Logger logger = LoggerFactory.getLogger(NameNode.class);

	private NameNodeRpcServer rpcServer;

	
	/**
	 * 初始化NameNode
	 */
	private void initialize() throws Exception {
		logger.debug("NameNode is initialize");
		this.rpcServer = new NameNodeRpcServer();
	}
	
	/**
	 * 让NameNode运行起来
	 */
	private void start() throws Exception {
		this.rpcServer.start();
		this.rpcServer.blockUntilShutdown();  
	}
		
	public static void main(String[] args) throws Exception {		
		NameNode namenode = new NameNode();
		namenode.initialize();
		namenode.start();
	}
	
}
